package controllers.validation;

import java.util.List;

import controllers.validation.jobs.SensorValidationJob;
import play.Logger;
import play.jobs.Every;
import play.jobs.Job;
import models.SensorConfig;

@Every("3s")
public class SensorJobStarter extends Job{
	
	public void startValidationJob() {
		List<String> measurementPoints = SensorConfig.getMeasurementPoints();
		Logger.info("Strart ValidationJob for MPs: %s", measurementPoints);
		for (String host : measurementPoints) {
			new SensorValidationJob(host).now();
		}
	}

	@Override
	public void doJob() throws Exception {
	    startValidationJob();
	}
}
